package com.ssy.lingxi.system.model.constant;

/**
 * 会员注册资料校验规则枚举（code和ruleName字段必须要与会员服务中的定义相同）
 * @author 万宁
 * @version 2.0.0
 * @date 2021-05-08
 */
public enum MemberConfigCheckRuleEnum {
    /**
     * 邮箱规则 - 1
     */
    MAIL(1, "邮箱规则", "^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$", "邮箱格式错误，请重新输入"),

    /**
     * 手机号码规则 - 2
     */
    PHONE(2, "手机号码规则", "^(1[3-9]\\d{9}$)", "手机号码格式错误，请重新输入"),

    /**
     * 身份证规则 - 3
     */
    ID_CARD(3, "身份证规则", "(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)", "身份证号码格式错误，请重新输入"),

    /**
     * 电话号码规则 - 4
     */
    TELEPHONE(4, "电话号码规则", "^[0][1-9]{2,3}-[0-9]{5,10}$", "手机号码格式错误，请重新输入");

    MemberConfigCheckRuleEnum(Integer code, String ruleName, String pattern, String msg) {
        this.code = code;
        this.ruleName = ruleName;
        this.pattern = pattern;
        this.msg = msg;
    }

    private Integer code;
    private String ruleName;
    private String pattern;
    private String msg;

    public Integer getCode() {
        return code;
    }

    public String getRuleName() {
        return ruleName;
    }

    public String getPattern() {
        return pattern;
    }

    public String getMsg() {
        return msg;
    }
}
